<template>
	<view style="height:100vh">
		<view class="item" v-for="item in newsList">
			<view class="item_left">
				<view class="item_left_text">
					{{item.text.substring(0,25)}}
				</view>
				<view class="item_left_time">2010-02-02</view>
			</view>
			<view class="item_right">
				<!-- <image class="img" :src="item.header" mode=""></image> -->
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				newsList: []
			}
		},
		onLoad() {
			this.getList()
		},
		onReachBottom() {
			this.getList()
		},
		methods: {
			getList() {
				let that = this
				uni.showLoading({
					title: '加载中'
				});
				wx.request({
					url: "https://api.apiopen.top/getJoke",
					method: "get",
					success: function(res) {
						if (res.data.code == 200) {
							uni.hideLoading();
							that.newsList = [...res.data.result, ...that.newsList]
						} else {
							wx.showToast({
								title: '加载失败',
								icon: 'loading'
							})
						}
					}
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	* {
		padding: 0rpx;
		margin: 0rpx;
	}

	page {
		height: 100vh;
	}

	.item {
		height: 15vh;
		width: 100%;
		display: flex;
		border-bottom: 2rpx solid rgba(0, 0, 0, 0.1);
	}

	.item_left {
		width: 70%;
		padding: 10rpx
	}

	.item_left_text {
		height: 125rpx;
		line-height: 40rpx;
		text-indent: 2rem;
		font-weight: 500;
		font-size: 28rpx;
	}

	.item_left_time {
		font-size: 28rpx;
		text-align: right;
	}

	.item_right {
		width: 30%;
		padding: 10rpx 0 10rpx 0;
		display: flex;
		justify-content: center;
	}

	.img {
		width: 80%;
		height: 12vh;
	}
</style>